package com.hyacinth.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 资源实体类
 * @author zhangfb
 * @version 1.0.0.1
 * @since JDK 1.8
 */
@Data
@Entity
@Table(name = "base_resource")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class Resource extends DataItemEntity{

    private static final long serialVersionUID = 1L;

    /** 上级资源编码 */
    @Column(
            name = "parent_code",
            length = 64
    )
    private String parentCode;

    /** 资源分类：system-子系统 module-子模块 catalog-目录 menu-菜单 func-功能 btn-按钮 html-页面*/
    @Column(
            name = "res_type",
            nullable = false,
            length = 10
    )
    private String resType;

    /** 资源状态 1启用  2禁用 0状态无效*/
    @Column(
            name = "res_flag",
            nullable = false,
            length = 1,
            columnDefinition = "char default '1'"
    )
    private String resFlag;

    /** 资源链接 */
    @Column(
            name = "res_url",
            length = 128
    )
    private String resUrl;

    /** 资源链接 GET POST PUT DELETE ...*/
    @Column(
            name = "res_method",
            length = 10
    )
    private String resMethod;

    /** 菜单图标 */
    @Column(
            name = "icon",
            length = 32
    )
    private String icon;

    /** 是否显示 */
    @Column(
            name = "is_show",
            nullable = false,
            length = 1,
            columnDefinition = "char default '1'"
    )
    private String isShow;

    /** 资源级别 */
    @Column(
            name = "level",
            nullable = false,
            length = 2,
            columnDefinition = "int(2)"
    )
    private int level;

    /** 排序 */
    @Column(
            name = "res_sort",
            columnDefinition = "int(5)"
    )
    private int resSort;

    /** 系统 */
    @Column(
            name = "system_code",
            length = 32
    )
    private String systemCode;
}
